package com.sprite.support.wechat.utils.model;

public class JsTicket {

	private String ticket;
	private long expiresIn;
	private long refreshTime;
	
	public String getTicket() {
		return ticket;
	}

	public long getExpiresIn() {
		return expiresIn;
	}
	
	public boolean isExpired() {
		return System.currentTimeMillis() - refreshTime + 1000 > expiresIn;
	}
	
	public void refresh(String ticket, long expiresIn) {
		refreshTime = System.currentTimeMillis();
		this.ticket = ticket;
		this.expiresIn = expiresIn;
	}
}
